Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New @turnkey/iframe-stamper package and email recovery example #129

Merged
merged 13 commits into from
Oct 17, 2023

Conversation

r-n-o
Copy link
Contributor

@r-n-o r-n-o commented Oct 10, 2023

Summary & Motivation

This PR adds a new package: @turnkey/iframe-stamper. This is an abstraction to work with iframes as signers (aka stampers).

Right now I envision @turnkey/iframe-stamper to be used mostly via our upcoming email recovery flow, but I can see this "iframe as stampers" idea being useful for other flows in the future: iframes and localStorage could be used to hold standard API keys rather than recovery credentials.

The new example covers the recovery flow.

How I Tested These Changes

recovery-first-cut.mov

Local testing for now. There's still a bunch of work that needs to be done to complete the example, but having this PR out in the open will be useful to get feedback!

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 10, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link
Contributor

@MaxBlaushild MaxBlaushild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Copy link
Collaborator

@andrewkmin andrewkmin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very minor nit: let's show this off in our top level README 🤩

but otherwise. this. looks. great!!!

examples/email-recovery/src/pages/index.tsx Show resolved Hide resolved
examples/email-recovery/src/pages/index.tsx Outdated Show resolved Hide resolved
examples/email-recovery/src/pages/index.tsx Outdated Show resolved Hide resolved
packages/iframe-stamper/README.md Outdated Show resolved Hide resolved
/**
* Inserts the iframe on the page and returns a promise resolving to the iframe's public key
*/
async init(): Promise<string> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏅 nice!!!

packages/iframe-stamper/src/index.ts Outdated Show resolved Hide resolved
// Instead of erroring out we simply return. Not our event!
return;
}
if (event.data && event.data["type"] == "BUNDLE_INJECTED") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny nit - same optional chaining pattern here (don't feel strongly).

could be useful to throw some of these types into consts in a single place

@r-n-o r-n-o force-pushed the rno/iframe-stamper branch from c0f7f9c to 16a167e Compare October 13, 2023 22:15
@r-n-o r-n-o merged commit c5a0b52 into main Oct 17, 2023
3 checks passed
@r-n-o r-n-o deleted the rno/iframe-stamper branch October 17, 2023 19:04
@oliviathet oliviathet mentioned this pull request Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants